package org.wxd.sign;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.wxd.sign.filter.RequestSignFilter;

import javax.servlet.DispatcherType;

@Configuration
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
    }


    @Bean
    public FilterRegistrationBean testFilterRegistration(RequestMappingHandlerMapping mapping) {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new RequestSignFilter(mapping));
        registration.addUrlPatterns("/*");
        registration.setOrder(1);
        registration.setDispatcherTypes(DispatcherType.REQUEST,DispatcherType.FORWARD);
        return registration;
    }
}
